#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

char buf[1024];
int len;
int main(int argc, char const *argv[])
{
	if(argc < 3)
		printf("usage: %s src_file dest_file", argv[0]);
	const char* src_file = argv[1];
	const char* dest_file = argv[2];
	int fd1,fd2;
 
	fd1 = open(src_file, O_RDWR | O_CREAT);
	fd2 = open(dest_file, O_RDWR | O_CREAT);
	while(len = read(fd1,buf,1024))
	{
		write(fd2,buf,len);
	}

	close(fd1);
	close(fd2);

	return 0;
}
